var postsData = require('../../data/posts-data.js')

Page({
    /**
     * 页面的初始数据
     */
    data: {
        indicatorDots: true,
        autoplay: true,
        interval: 3000
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad (options) {
        this.setData({
            postList: postsData.postList
        })
    },
    // 轮播图跳转到详情页
    onSwiperTap (event) {
        var postId = event.target.dataset.postid
        wx.navigateTo({
            url: 'post-detail/post-detail?id=' + postId
        })
    },

    // 跳转到详情页
    onPostTap (event) {
        var postId = event.currentTarget.dataset.postid
        // console.log(postId)
        wx.navigateTo({
            url: 'post-detail/post-detail?id=' + postId,
        })
    }
})